#include "Shm.hpp"
#include "FIFO.hpp"

int main()
{
    Shm shm(gpath, gproj_id, CREATER);

    NamedFifo fifo(".", "FIFO");
    FileOper readfile = FileOper(".", "FIFO");
    readfile.OpenForRead();

    while (1)
    {
        if (readfile.Wait() == true)
        {
            char *p = (char *)shm.VirtualAdd();
            printf("%s\n", p);
            // sleep(1);
        }
        else
        {
            std::cout << "readFIFO empty" << std::endl;
            std::cout << std::endl;
            break;
        }
    }

    readfile.Close();
    return 0;
}